﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;
using CampusMarket.Model;

namespace CampusMarket.ViewModel
{
    public class VMPostItem : INotifyPropertyChanged
    {
        Goods _goods = new Goods();
        public ObservableCollection<string> imgList { get; set; }
        string _curPath = "";
        string _contact = "";
        public Goods goods { 
            get { return _goods; }
            set { _goods = value; NotifyPropertyChanged("goods"); }
        }
        public string curPath {
            get { return _curPath; }
            set { _curPath = value; NotifyPropertyChanged("curPath"); }
        }
        public string contact
        {
            get { return _contact; }
            set { _contact = value; NotifyPropertyChanged("contact"); }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public void NotifyPropertyChanged(string property)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
        public override string ToString()
        {
            return string.Format("Name:{0}\nOPrice:{1}\nType:{2}\nCoord:{3},{4}\nDesc:{5}\nContact:{6}",
                goods.Goods_Name, goods.Goods_OriginPrice, goods.Goods_Type, goods.Goods_latitude, goods.Goods_longitude,
                goods.Goods_Content, contact);
        }
    }
}
